//
//  DeviceUserCell.m
//  efairy
//
//  Created by 李锋 on 2019/2/20.
//  Copyright © 2019年 East. All rights reserved.
//

#import "DeviceUserCell.h"

@implementation DeviceUserCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if(self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]){
        [self initView];
    }
    return self;
    
}

-(void)initView{
    _phoneValue = [[UILabel alloc]init];
    _phoneValue.backgroundColor = [UIColor whiteColor];
    _phoneValue.textColor = ColorFromRGB(0x666666);
    _phoneValue.font = [UIFont systemFontOfSize:16.f];
    _phoneValue.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:_phoneValue];
    _phoneValue.sd_layout.heightIs(50)
    .leftSpaceToView(self.contentView, 0)
    .rightSpaceToView(self.contentView, 0);
     [self setupAutoHeightWithBottomView:_phoneValue bottomMargin:0];
}

-(void)setModeDatas:(DeviceUserList *)data{
    if(data){
        if(data.is_charger == 1){
            _phoneValue.text  = [NSString stringWithFormat:@"%@-%@(负责人)",
                                 data.efairyuser_nickname,
                                 data.efairyuser_phonenumber?data.efairyuser_phonenumber:@""];
        }else{
            _phoneValue.text  = [NSString stringWithFormat:@"%@-%@",
                                 data.efairyuser_nickname,
                                 data.efairyuser_phonenumber?data.efairyuser_phonenumber:@""];
        }
       
        
    }
}

@end
